<?php
declare (strict_types = 1);

namespace app\model;

use Exception;
use think\Model;

/**
 * @mixin Model
 */
class Product extends Model
{
    /**
     * 批量写入商品
     * @param $data
     * @return array
     */
    public function createProduct($data): array
    {
        try {
            $this->saveAll($data);
            return modelResponse(200, '创建成功');
        }catch (Exception $e){
            return modelResponse($e->getCode(), $e->getMessage());
        }
    }
}
